package day04;

//1.导入一个扫描仪
import java.util.Scanner;

public class ScannerDemo1 {
    public static void main(String[] args) {
        /*
        Scanner的推演
          package java.util;
          class Scanner{
            Scanner(InputStream s){ ... }
            int nextInt(){ ... }
            double nextDouble(){ ... }
          }

          import java.util.Scanner;
          Scanner scan = new Scanner(System.in);
          int age = scan.nextInt();
          double price = scan.nextDouble();
         */
        //2.新建一个扫描仪，叫scan
        Scanner scan = new Scanner(System.in);
        //在命令行输入一个整数，回车
        System.out.println("请输入年龄：");
        //3.扫描一个整数并赋值给age
        int age = scan.nextInt();
        //命令行中输出 年龄为+输入的数字
        System.out.println("年龄为："+age);
    }
}
